<template>
  <view class="agreement">
    <view v-html="agreement.AGREEMENT"></view>
    <view class='flex'>
      <radio-group class="radio-group" @click="radioChange">
        <label class="radio">
          <checkbox :checked="disabled" class="checkbox"/>
          <text>以上内容本家庭全体成员已经认真阅读并知悉</text>
        </label>
      </radio-group>
      <view class="agreement_but">
        <button @click="goAllowances" :class="['but',disabled? 'agreed':'']">同意</button>
        <button @click="goback" class="refused">拒绝</button>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        disabled: false,
        agreement: ''
      }
    },
    onLoad() {
      this.getAgreement()
    },
    methods: {
      radioChange (e) {
        this.disabled = !this.disabled
      },
      getAgreement () {
        uni.showLoading({
          title: '加载中'
        });
        this.$http.get('agreement',{params: {CLASS1: '', CLASS2: ''}}).then(res => {
          this.agreement = res.data;
          uni.hideLoading()
        }).catch(err => {
        })
      },
      goAllowances () {
        if (!this.disabled) {
          return false
        }
        uni.redirectTo({
					url: './masterUser'
				})
      },
      goback () {
        uni.navigateBack({
          delta: 1
        });
      }
    }
  }
</script>

<style lang="scss" scoped>
  .agreement{
    padding:30upx 16upx 0upx 16upx;
    color: #101010;
    text-align: justify;
    font-size: 30upx;
    overflow: auto;
    height: 80vh;
    line-height: 1.8;
  }
  .agreement_but{
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-content: center;
    text-align: center;
    padding-bottom: 20upx;
    button{
      color: #fff;
      width: 330upx;
      height: 94upx;
      font-size: 36upx;
    }
    .but{
      color: #979797;
      background:#DADBDD;
    }
    .but.agreed{
      color: #fff;
      background-color: #E64340;
      border: #E64340 1px solid;
    }
    .refused{
      color: #1EC88B;
      background-color: #fff;
      border: #1EC88B 1px solid;
    }
  }
.flex .radio-group{
  text-align: center;
  font-size: 26upx;
  color: #1F1F1F;
  margin: 0upx 0 25upx 0;
}
.flex .radio-group checkbox{
  vertical-align: middle;
  margin-right: 6upx;
}
.flex .radio-group text{
  vertical-align: middle;
  display: inline-block;
}
.flex{
  background-color: #fff;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}
.flex .next{
  font-size: 34upx;
  font-weight: 500;
  text-align: center;
  color: #979797;
  height: 98upx;
  line-height: 98upx;
  background:#DADBDD;
}
.flex .nextOK{
  background-color: #1EC88B;
  color: #fff;
}
</style>